/***
 *                 .-~~~~~~~~~-._       _.-~~~~~~~~~-.
 *             __.'              ~.   .~              `.__
 *           .'//                 \./                   \\`.
 *         .'//                     |                     \\`.
 *       .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
 *     .'//.-"                 `-.  |  .-'                 "-.\\`.
 *   .'//______.============-..   \ | /   ..-============.______\\`.
 * .'______________________________\|/______________________________`.
 * When I wrote this, only God and I understood what I was doing
 *                      Now, God only knows
 * ALL IS WELL!!!
 * @author Zero~guang
 * @create 2021-07-15 21:12
 */
package com.qianfeng.strategy.filter.impl;

import com.qianfeng.smsplatform.common.model.Standard_Submit;
import com.qianfeng.strategy.cache.BlackNumLocalCache;
import com.qianfeng.strategy.filter.FilterChain;
import org.springframework.stereotype.Component;

@Component
public class BlackFilterWithLocalCache implements FilterChain {

    @Override
    public boolean dealSms(Standard_Submit standard_submit) {
        String destMobile = standard_submit.getDestMobile();//获取到当前的手机号

        boolean isMember = BlackNumLocalCache.isMember(destMobile);//从本地中进行判断
        //如果返回true 意味着是黑名单,否则就不是
        if (isMember) {
            System.err.println(destMobile + "------->在黑名单中set");
        }else{
            System.err.println(destMobile + "========>不在黑名单中set");
            return true;
        }
        return false;
    }
}
